﻿
@model cloudscribe.Core.Web.ViewModels.CoreData.CountryListPageViewModel
@inject ICoreThemeHelper themeHelper
@inject IStringLocalizer<CloudscribeCore> sr
@{
    ViewData["Title"] = sr["Country List Administration"];
    var themeSettings = themeHelper.GetThemeSettings();
    if (themeSettings.AdminSideNavExpanded) { ViewData["SideNavToggle"] = "show"; }
    ViewData["SideNavVisible"] = true;
}
<h2>@ViewData["Title"]</h2>
<table class="table table-striped table-hover table-sm">
    <thead>
        <tr>
            <th scope="col">
                <a class="btn btn-link" asp-action="CountryEdit" asp-controller="CoreData"
                   asp-route-countryid="@Guid.Empty"
                   asp-route-pagenumber="@Model.Countries.PageNumber">@sr["New Country"]</a>
            </th>
            <th scope="col">
                @sr["Name"]
            </th>
            <th scope="col">
                @sr["ISOCode2"]
            </th>
            <th scope="col">
                @sr["ISOCode3"]
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var c in Model.Countries.Data)
        {
            <tr>
                <td>
                    <a class="btn btn-link" asp-action="CountryEdit" asp-controller="CoreData"
                       asp-route-countryId="@c.Id"
                       asp-route-returnPageNumber="@Model.Countries.PageNumber">@sr["Edit"]</a>

                    <a class="btn btn-link" asp-action="StateListPage" asp-controller="CoreData"
                       asp-route-countryId="@c.Id"
                       asp-route-crp="@Model.Countries.PageNumber">@sr["States"]</a>
                </td>
                <td>
                    @c.Name
                </td>
                <td>
                    @c.ISOCode2
                </td>
                <td>
                    @c.ISOCode3
                </td>
            </tr>
        }
    </tbody>
</table>
<cs-pager asp-action="CountryListPage" asp-controller="CoreData"
          asp-route-pagesize="@Model.Countries.PageSize"
          cs-paging-pagenumber="@Model.Countries.PageNumber"
          cs-paging-totalitems="@Model.Countries.TotalItems"
          cs-first-page-title='@sr["First Page"]'
          cs-last-page-title='@sr["Last Page"]'
          cs-previous-page-title='@sr["Previous page"]'
          cs-next-page-title='@sr["Next page"]'
          cs-pager-ul-class="pagination d-flex flex-wrap"
          cs-pager-li-current-class="page-item active"
          cs-pager-li-other-class="page-item"
          cs-pager-li-non-active-class="page-item disabled"
          cs-pager-link-current-class="page-link"
          cs-pager-link-other-class="page-link"></cs-pager>

@section SideNav {
    <partial name="AdminSideNav" />
}
@section Toolbar{
    <partial name="AdminSideNavToggle" />
}
@section scripts {
    <partial name="AdminSideNavScripts" />
}

